# Maintainer: David Runge <dvzrv@archlinux.org>

_name=doit
pkgname=python-doit
pkgver=0.36.0
pkgrel=4
pkgdesc="A task management and automation tool"
arch=(any)
url="https://pydoit.org/"
license=(MIT)
depends=(
  ipython
  python
  python-cloudpickle
  python-pyinotify
)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-doit-py
  python-pyflakes
  python-pytest
  python-toml
)
optdepends=(
  'python-toml: for TOML support'
  'python-setuptools: for plugin support'
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('d4caa31701755c7f59213dde0f89fd3616c0c01b7f06245cbfd9f1a315d503e62f3556c3b86685cd0ebfcffcc9cae0987ca150f037aa7b3cd960439a1191be42')
b2sums=('15558a39ccac031ddf3a429aa585bc6e1d49c2e7572df29979ca66d1025fa5d7a917f6cc5bcfd21f2749e4ed7e7885b0865ec67b6fa32817e1518d47da9ead97')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build/lib:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
  install -vDm 644 {AUTHORS,CHANGES,CONTRIBUTING.md,README.rst} -t "$pkgdir/usr/share/doc/$pkgname"
  install -vDm 644 bash_completion_$_name "$pkgdir/usr/share/bash-completion/completions/$_name"
  install -vDm 644 zsh_completion_$_name "$pkgdir/usr/share/zsh/site-functions/_$_name"
}
